package com.yuanrui.practice.server.enums;

import lombok.Getter;

@Getter
public enum AnswerStatusEnum {

    CORRECT(1, "正确"),
    ERROR(0, "错误");

    private final Integer code;

    private final String desc;

    AnswerStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static AnswerStatusEnum getByCode(Integer code) {
        for (AnswerStatusEnum value : values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }
}
